home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / intrlib1.zip / INTRTEST.C < prev    next >
C/C++ Source or Header  |  1992-03-10  |  22KB  |  698 lines

  1. #include <time.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <graphics.h>
  6. #ifdef __MSDOS__
  7. #include <conio.h>
  8. #endif /* __MSDOS__ */
  9. #include "intr_lib.h"
  10. #include "intr_gr.h"
  11.  
  12. static int RWindowID;
  13.  
  14. static IntrBType
  15.     QuitProgram = FALSE;
  16.  
  17. static IntrPopUpMenuStruct *PUWndwMenu, *PUMenu1, *PUMenu2, *PUMenu3;
  18.  
  19. static char *Menu1Str[] = {
  20.     "Selection 0",
  21.     "Selection 1",
  22.     "Selection 2",
  23.     "Selection 3"
  24. };
  25. #define MENU1_SIZE (sizeof(Menu1Str) / sizeof(char *))
  26.  
  27. static char *Menu3Str[] = {
  28.     "Item 0",
  29.     "Item 1",
  30.     "Item 2",
  31.     "Item 3",
  32.     "Item 4",
  33.     "Item 5",
  34.     "Item 6"
  35. };
  36. #define MENU3_SIZE (sizeof(Menu3Str) / sizeof(char *))
  37.  
  38. static char *PullDownStrs[] = {
  39.     "Menu1",
  40.     "Menu2",
  41.     "Menu3",
  42.     "Data",
  43.     "View",
  44.     "Status",
  45.     "Quit"
  46. };
  47. static void PullDownMenu1Func(int Index);
  48. static void PullDownMenu2Func(int Index);
  49. static void PullDownMenu3Func(int Index);
  50. static void PullDownDataFunc(int Index);
  51. static void PullDownViewFunc(int Index);
  52. static void PullDownStatusFunc(int Index);
  53. static void PullDownQuitFunc(int Index);
  54. static IntrIntFunc PullDownActions[] = {
  55.     PullDownMenu1Func,
  56.     PullDownMenu2Func,
  57.     PullDownMenu3Func,
  58.     PullDownDataFunc,
  59.     PullDownViewFunc,
  60.     PullDownStatusFunc,
  61.     PullDownQuitFunc
  62. };
  63. #define PULL_DOWN_SIZE (sizeof(PullDownStrs) / sizeof(char *))
  64.  
  65. static char *WindowMenuStrs[] = {
  66.     "Redraw All",
  67.     "Move",
  68.     "Resize",
  69.     "Pop",
  70.     "Push",
  71.     "Show Red Wndw",
  72.     "Hide Red Wndw"
  73. };
  74. #define WINDOW_MENU_SIZE (sizeof(WindowMenuStrs) / sizeof(char *))
  75.  
  76. static void RandomBBox(IntrBBoxStruct *BBox);
  77. static void RedRefreshFunction(int WindowID);
  78. static void QuitFunc(int KeyStroke);
  79. static void WndwMenuFunc(int KeyStroke);
  80.  
  81. /******************************************************************************
  82. * A simple test for the Intr_lib library.                      *
  83. ******************************************************************************/
  84. void main(int argc, char **argv)
  85. {
  86.     int GWindowID, BWindowID, YWindowID, CWindowID, MWindowID, WWindowID,
  87.         i, j, x, y, Exit;
  88.     char Buffer[1024], Line[128], Str[128];
  89.     IntrBType SmoothScrolling;
  90.     FILE *f;
  91.     IntrBBoxStruct BBox;
  92.     IntrCursorShapeStruct Cursor;
  93.     IntrPullDownMenuStruct *PDMenu;
  94.  
  95. #ifdef __MSDOS__
  96.     if (argc == 2)
  97.         switch(argv[1][0]) {
  98.         case 'b':
  99.                 GRInstallSVGA("vga256.1");
  100.         GRSetBGIPath("c:/bc/bgi");
  101.         break;
  102.         case 'S':
  103.         GRInstallSVGA("ati.2");
  104.         GRSetBGIPath("c:/bc/bgi/ati");
  105.         break;
  106.         case 's':
  107.         GRInstallSVGA("svga256.3");
  108.         GRSetBGIPath("c:/bc/bgi/ati");
  109.         break;
  110.         default:
  111.         fprintf(stderr, "Undefined command line argument\n"
  112.                 "Usage: \"Test [S] [s]\".\n");
  113.         exit(1);
  114.         break;
  115.     }
  116.     else
  117.     GRSetBGIPath("c:/bc/bgi");
  118.  
  119.     randomize();
  120. #endif /* __MSDOS__ */
  121.  
  122.     IntrSetSaveBackPath("d:\\");
  123.     IntrSetSaveBackMethod(INTR_SAVE_DISK);
  124.  
  125.     IntrInit();
  126.  
  127.     IntrSetMouseSensitivity(16);
  128.     IntrSetAsyncEventMode(TRUE);
  129.  
  130.     IntrSetInputDevice(INTR_INPT_DEVICE_MOUSE |
  131.                /* INTR_INPT_DEVICE_JOYSTICK | */
  132.                INTR_INPT_DEVICE_KEYBOARD);
  133.  
  134.     IntrSetAtKeyboard(TRUE);
  135.     IntrRegisterKeyStroke(0x110 /* Alt Q */, QuitFunc);
  136.     IntrRegisterKeyStroke(0x171 /* Alt F10 */, WndwMenuFunc);
  137.  
  138.     /* Set the default cursor to arrow. */
  139.     Cursor.CursorType = INTR_CURSOR_ARROW;
  140.     IntrSetCursorType(&Cursor);
  141.  
  142.     /* Prepare a first pop up menu of 4 items, in strings array. */
  143.     PUMenu1 = IntrPopUpMenuCreate("Menu1 Header", Menu1Str, 0, MENU1_SIZE,
  144.                   INTR_COLOR_RED, INTR_COLOR_BLUE,
  145.                                   INTR_COLOR_YELLOW, INTR_COLOR_MAGENTA,
  146.                   8, &Cursor);
  147.  
  148.     /* Prepare a second menu of 5 items, 15 chars wide. */
  149.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  150.     for (i = 0; i < 5; i++) sprintf(&Str[i * 13], "Menu Item %d", i);
  151.     PUMenu2 = IntrPopUpMenuCreate("Menu2 Header", (char **) Str, 13, 5,
  152.                   INTR_COLOR_GREEN, INTR_COLOR_YELLOW,
  153.                                   INTR_COLOR_CYAN, INTR_COLOR_MAGENTA,
  154.                                   16, &Cursor);
  155.  
  156.     /* Prepare a third pop up menu with no name, in strings array. */
  157.     PUMenu3 = IntrPopUpMenuCreate(NULL, Menu3Str, 0, MENU3_SIZE,
  158.                   INTR_COLOR_GREEN, INTR_COLOR_YELLOW,
  159.                                   INTR_COLOR_CYAN, INTR_COLOR_MAGENTA,
  160.                                   8, &Cursor);
  161.  
  162.     /* And prepare the window pop up menu. */
  163.     PUWndwMenu = IntrPopUpMenuCreate("Window", WindowMenuStrs, 0,
  164.                       WINDOW_MENU_SIZE,
  165.                   INTR_COLOR_GREEN, INTR_COLOR_CYAN,
  166.                                   INTR_COLOR_YELLOW, INTR_COLOR_MAGENTA,
  167.                                   16, &Cursor);
  168.  
  169.     Cursor.CursorType = INTR_CURSOR_ARROW;
  170.     IntrQueryContinue("This is a \"Continue\" query.",
  171.                   INTR_COLOR_RED,
  172.                       INTR_COLOR_BLUE,
  173.                       INTR_COLOR_YELLOW,
  174.                       INTR_COLOR_RED,
  175.                       8,
  176.                       &Cursor,
  177.                       RWindowID);
  178.  
  179.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  180.     IntrQueryYesNo("This is a \"Yes-No\" query.",
  181.               INTR_COLOR_CYAN,
  182.                       INTR_COLOR_RED,
  183.                       INTR_COLOR_WHITE,
  184.                       INTR_COLOR_YELLOW,
  185.                       8,
  186.                       &Cursor,
  187.                       INTR_WNDW_PLACE_CENTER);
  188.  
  189.     strcpy(Line, "Preset string");
  190.     IntrQueryLine("This is a \"Line\" query.",
  191.           Line,
  192.                   79,
  193.               INTR_COLOR_MAGENTA,
  194.                   INTR_COLOR_RED,
  195.                   INTR_COLOR_WHITE,
  196.                   12,
  197.                   INTR_WNDW_PLACE_CENTER);
  198.  
  199.     for (i = 0; i < 50; i++) sprintf(&Buffer[i * 10], "Item %d", i);
  200.     Cursor.CursorType = INTR_CURSOR_ARROW;
  201.     for (i = 0; i < 4; i++) {
  202.         j = IntrQueryList("List Query",
  203.                   (char **) Buffer,
  204.               10,
  205.                       50,
  206.                       10,
  207.               INTR_COLOR_MAGENTA,
  208.               INTR_COLOR_BLUE,
  209.               INTR_COLOR_YELLOW,
  210.               INTR_COLOR_YELLOW,
  211.                       12,
  212.                       &Cursor,
  213.                       INTR_WNDW_PLACE_CENTER);
  214.  
  215.     sprintf(Line, "List item %d was selected", j);
  216.     IntrQueryContinue(Line,
  217.                       INTR_COLOR_RED,
  218.                           INTR_COLOR_BLUE,
  219.                           INTR_COLOR_YELLOW,
  220.                           INTR_COLOR_MAGENTA,
  221.                           16,
  222.                           &Cursor,
  223.                           INTR_WNDW_PLACE_CENTER);
  224.     }
  225.  
  226.     for (i = 0; i < 4; i++) {
  227.     if (IntrPopUpMenu(PUMenu1, 0)) {
  228.             sprintf(Buffer, "Item %d was selected.", PUMenu1 -> SelectedIndex);
  229.     }
  230.     else {
  231.             sprintf(Buffer, "Abort was keyed on item %d.", PUMenu1 -> SelectedIndex);
  232.     }
  233.     IntrQueryContinue(Buffer,
  234.                       INTR_COLOR_RED,
  235.                           INTR_COLOR_BLUE,
  236.                           INTR_COLOR_YELLOW,
  237.                           INTR_COLOR_MAGENTA,
  238.                           12,
  239.                           &Cursor,
  240.                           INTR_WNDW_PLACE_CENTER);
  241.     }
  242.  
  243.     for (i = 0; i < 4; i++) {
  244.     if (IntrPopUpMenu(PUMenu2, 0)) {
  245.             sprintf(Buffer, "Item %d was selected.", PUMenu2 -> SelectedIndex);
  246.     }
  247.     else {
  248.             sprintf(Buffer, "Abort was keyed on item %d.", PUMenu2 -> SelectedIndex);
  249.     }
  250.     IntrQueryContinue(Buffer,
  251.               INTR_COLOR_RED,
  252.                           INTR_COLOR_BLUE,
  253.                           INTR_COLOR_YELLOW,
  254.                           INTR_COLOR_CYAN,
  255.                           10,
  256.                           &Cursor,
  257.                           INTR_WNDW_PLACE_CENTER);
  258.     }
  259.  
  260.     Cursor.CursorType = INTR_CURSOR_CROSS;
  261.  
  262.     BBox.Xmin = 50;
  263.     BBox.Ymin = 50;
  264.     BBox.Xmax = GRScreenMaxX - 50;
  265.     BBox.Ymax = GRScreenMaxY - 50;
  266.     RWindowID = IntrWndwCreate("Red Window",
  267.                        12,
  268.                        &BBox,
  269.                        INTR_COLOR_RED,
  270.                    INTR_COLOR_BLUE,
  271.                    &Cursor,
  272.                                NULL,
  273.                                NULL);
  274.  
  275.     BBox.Xmin = 100;
  276.     BBox.Ymin = 100;
  277.     BBox.Xmax = GRScreenMaxX - 30;
  278.     BBox.Ymax = GRScreenMaxY - 30;
  279.     PDMenu = IntrPullDownMenuCreate(PullDownStrs, 0, PULL_DOWN_SIZE,
  280.                         PullDownActions,
  281.                     INTR_COLOR_GREEN, INTR_COLOR_BLACK,
  282.                                     INTR_COLOR_YELLOW, INTR_COLOR_CYAN, 8);
  283.     GWindowID = IntrWndwCreate("Window with Pull Down menu.",
  284.                        8,
  285.                        &BBox,
  286.                    INTR_COLOR_GREEN,
  287.                    INTR_COLOR_YELLOW,
  288.                    &Cursor,
  289.                                PDMenu,
  290.                                NULL);
  291.  
  292.     RandomBBox(&BBox);
  293.     BWindowID = IntrWndwCreate("Blue Window",
  294.                        8,
  295.                        &BBox,
  296.                        INTR_COLOR_BLUE,
  297.                    INTR_COLOR_RED,
  298.                    &Cursor,
  299.                                NULL,
  300.                                NULL);
  301.  
  302.     RandomBBox(&BBox);
  303.     YWindowID = IntrWndwCreate("Yellow Window",
  304.                        1,
  305.                        &BBox,
  306.                        INTR_COLOR_YELLOW,
  307.                    INTR_COLOR_BLUE,
  308.                    &Cursor,
  309.                                NULL,
  310.                                NULL);
  311.  
  312.     RandomBBox(&BBox);
  313.     CWindowID = IntrWndwCreate("Cyan Window",
  314.                        12,
  315.                        &BBox,
  316.                        INTR_COLOR_CYAN,
  317.                    INTR_COLOR_RED,
  318.                    &Cursor,
  319.                                NULL,
  320.                                NULL);
  321.  
  322.     RandomBBox(&BBox);
  323.     MWindowID = IntrWndwCreate("Magenta Window",
  324.                        8,
  325.                        &BBox,
  326.                        INTR_COLOR_MAGENTA,
  327.                    INTR_COLOR_GREEN,
  328.                    &Cursor,
  329.                                NULL,
  330.                                NULL);
  331.  
  332.     RandomBBox(&BBox);
  333.     WWindowID = IntrWndwCreate(NULL,
  334.                        10,
  335.                        &BBox,
  336.                        INTR_COLOR_WHITE,
  337.                    INTR_COLOR_MAGENTA,
  338.                    &Cursor,
  339.                                NULL,
  340.                                NULL);
  341.  
  342.  
  343.     IntrWndwPop(RWindowID, FALSE, TRUE);
  344.  
  345.     IntrWndwPop(BWindowID, FALSE, TRUE);
  346.     IntrWndwPop(YWindowID, FALSE, TRUE);
  347.     IntrWndwPop(CWindowID, FALSE, TRUE);
  348.     IntrWndwPop(MWindowID, FALSE, TRUE);
  349.     IntrWndwPop(WWindowID, FALSE, TRUE);
  350.  
  351.     IntrTextInitWindow(RWindowID, TRUE, INTR_COLOR_YELLOW, INTR_COLOR_RED,
  352.                    INTR_SCRLBAR_NONE, INTR_SCRLBAR_LEFT, 50, 80);
  353.     IntrWndwSetRefreshFunc(RWindowID, RedRefreshFunction);
  354.  
  355.     if ((f = fopen("intr_lib.h", "r")) == NULL) {
  356.     IntrFatalError("Failed to open \"intr_lib.h\".");
  357.         exit(1);
  358.     }
  359.  
  360.     IntrQueryContinue("Type SPACE to toggle smooth scroll, RETURN to quit.",
  361.                   INTR_COLOR_RED,
  362.                       INTR_COLOR_BLUE,
  363.                       INTR_COLOR_YELLOW,
  364.                       INTR_COLOR_CYAN,
  365.                       16,
  366.                       &Cursor,
  367.                       INTR_WNDW_PLACE_CENTER);
  368.  
  369.     /* Fill the window with some text without window update. */
  370.     for (i = j = 0; i < 30 && fgets(Buffer, 127, f); i++)
  371.     IntrPrintf(RWindowID, FALSE, "%3d : %s", j++, Buffer);
  372.  
  373.     Exit = FALSE;
  374.     IntrTextSetSmoothScroll(SmoothScrolling = FALSE);
  375.     IntrInputFlush();
  376.     while (!Exit && fgets(Buffer, 127, f)) {
  377.     if (IntrKbHit()) switch(IntrGetch())
  378.         {
  379.            case ' ':
  380.            SmoothScrolling = !SmoothScrolling;
  381.            IntrTextSetSmoothScroll(SmoothScrolling);
  382.                break;
  383.            case 10:
  384.            case 13:
  385.            Exit = TRUE;
  386.                break;
  387.         }
  388.     IntrPrintf(RWindowID, TRUE, "%3d : %s", j++, Buffer);
  389.     }
  390.  
  391.     fclose(f);
  392.  
  393.     strcpy(Buffer, "Type anything you want, \"Quit\" to quit lines entering.");
  394.     do {
  395.     IntrGetLineWindow(RWindowID, Buffer, 79);
  396.     IntrPrintf(RWindowID, TRUE, Buffer);
  397.     }
  398.     while (strncmp(Buffer, "quit", 4) && strncmp(Buffer, "QUIT", 4));
  399.  
  400.     IntrQueryContinue("The RED text window is about to be hidden.",
  401.                   INTR_COLOR_RED,
  402.                       INTR_COLOR_BLUE,
  403.                       INTR_COLOR_YELLOW,
  404.                       INTR_COLOR_MAGENTA,
  405.                       16,
  406.                       &Cursor,
  407.                       INTR_WNDW_PLACE_CENTER);
  408.     IntrWndwHide(RWindowID, TRUE);
  409.  
  410.     IntrQueryContinue("We are about to pop a window with pull down menu.",
  411.                   INTR_COLOR_RED,
  412.                       INTR_COLOR_BLUE,
  413.                       INTR_COLOR_YELLOW,
  414.                       INTR_COLOR_GREEN,
  415.                       16,
  416.                       &Cursor,
  417.                       INTR_WNDW_PLACE_CENTER);
  418.  
  419.     IntrWndwPop(GWindowID, FALSE, TRUE);
  420.  
  421.     IntrQueryContinue("Type \"Alt F10\" for window handling",
  422.                   INTR_COLOR_RED,
  423.                       INTR_COLOR_BLUE,
  424.                       INTR_COLOR_YELLOW,
  425.                       INTR_COLOR_CYAN,
  426.               16,
  427.                       &Cursor,
  428.                       INTR_WNDW_PLACE_CENTER);
  429.  
  430.     IntrSetHandleInternalEvents(TRUE, FALSE);
  431.     Cursor.CursorType = INTR_CURSOR_CROSS;
  432.     do {
  433.         switch (IntrGetEventWait(&x, &y)) {
  434.             case INTR_EVNT_SELECT:
  435.         sprintf(Buffer,"SELECT Event at %d %d", x, y);
  436.             IntrQueryContinue(Buffer,
  437.                               INTR_COLOR_RED,
  438.                           INTR_COLOR_BLUE,
  439.                           INTR_COLOR_YELLOW,
  440.                               INTR_COLOR_CYAN,
  441.                           16,
  442.                           &Cursor,
  443.                           INTR_WNDW_PLACE_CENTER);
  444.                 break;
  445.             case INTR_EVNT_ABORT:
  446.         sprintf(Buffer,"ABORT Event at %d %d", x, y);
  447.             IntrQueryContinue(Buffer,
  448.                               INTR_COLOR_RED,
  449.                           INTR_COLOR_BLUE,
  450.                           INTR_COLOR_YELLOW,
  451.                               INTR_COLOR_CYAN,
  452.                           16,
  453.                           &Cursor,
  454.                           INTR_WNDW_PLACE_CENTER);
  455.                 break;
  456.     }
  457.     }
  458.     while (!QuitProgram);
  459.  
  460.     IntrPopUpMenuDelete(PUMenu1);
  461.     IntrPopUpMenuDelete(PUMenu2);
  462.     IntrPopUpMenuDelete(PUWndwMenu);
  463.     IntrWndwDelete(RWindowID, FALSE);
  464.     IntrWndwDelete(GWindowID, FALSE);
  465.     IntrWndwDelete(BWindowID, FALSE);
  466.     IntrWndwDelete(YWindowID, FALSE);
  467.     IntrWndwDelete(CWindowID, FALSE);
  468.     IntrWndwDelete(MWindowID, FALSE);
  469.     IntrWndwDelete(WWindowID, TRUE);
  470.  
  471.     IntrClose();
  472. }
  473.  
  474. /******************************************************************************
  475. * A random function to pick a bbox in screen space.                  *
  476. ******************************************************************************/
  477. static void RandomBBox(IntrBBoxStruct *BBox)
  478. {
  479. #ifdef __MSDOS__
  480.     BBox -> Xmin = 20 + random(GRScreenMaxX - 180);
  481.     BBox -> Ymin = 20 + random(GRScreenMaxY - 180);
  482.     BBox -> Xmax = BBox -> Xmin + 100 +
  483.                    random(GRScreenMaxX - 140 - BBox -> Xmin);
  484.     BBox -> Ymax = BBox -> Ymin + 100 +
  485.                    random(GRScreenMaxY - 140 - BBox -> Ymin);
  486. #endif /* __MSDOS__ */
  487. #ifdef DJGCC
  488.     BBox -> Xmin = 20 + random() % (GRScreenMaxX - 180);
  489.     BBox -> Ymin = 20 + random() % (GRScreenMaxY - 180);
  490.     BBox -> Xmax = BBox -> Xmin + 100 +
  491.                random() % (GRScreenMaxX - 140 - BBox -> Xmin);
  492.     BBox -> Ymax = BBox -> Ymin + 100 +
  493.                random() % (GRScreenMaxY - 140 - BBox -> Ymin);
  494. #endif /* DJGCC */
  495. }
  496.  
  497. /******************************************************************************
  498. * A routine invoked when ever the RED window needs to be refreshed.          *
  499. ******************************************************************************/
  500. static void RedRefreshFunction(int WindowID)
  501. {
  502.     IntrTextWndwRefresh(WindowID);
  503. }
  504.  
  505. /******************************************************************************
  506. * A set of routines called upon activation of the pull down menu.          *
  507. ******************************************************************************/
  508. static void PullDownMenu1Func(int Index)
  509. {
  510.     char Buffer[80];
  511.     IntrCursorShapeStruct Cursor;
  512.  
  513.     if (IntrPopUpMenu(PUMenu1, INTR_WNDW_PULL_DOWN)) {
  514.         sprintf(Buffer, "Item %d was selected.", PUMenu1 -> SelectedIndex);
  515.     }
  516.     else {
  517.         sprintf(Buffer, "Abort was keyed on item %d.", PUMenu1 -> SelectedIndex);
  518.     }
  519.  
  520.     Cursor.CursorType = INTR_CURSOR_ARROW;
  521.     IntrQueryContinue(Buffer,
  522.                   INTR_COLOR_RED,
  523.                       INTR_COLOR_BLUE,
  524.                       INTR_COLOR_YELLOW,
  525.                       INTR_COLOR_CYAN,
  526.                       12,
  527.                       &Cursor,
  528.                       INTR_WNDW_PLACE_CENTER);
  529. }
  530.  
  531. static void PullDownMenu2Func(int Index)
  532. {
  533.     char Buffer[80];
  534.     IntrCursorShapeStruct Cursor;
  535.  
  536.     if (IntrPopUpMenu(PUMenu2, INTR_WNDW_PULL_DOWN)) {
  537.         sprintf(Buffer, "Item %d was selected.", PUMenu2 -> SelectedIndex);
  538.     }
  539.     else {
  540.         sprintf(Buffer, "Abort was keyed on item %d.", PUMenu2 -> SelectedIndex);
  541.     }
  542.  
  543.     Cursor.CursorType = INTR_CURSOR_ARROW;
  544.     IntrQueryContinue(Buffer,
  545.                   INTR_COLOR_RED,
  546.                       INTR_COLOR_BLUE,
  547.                       INTR_COLOR_YELLOW,
  548.                       INTR_COLOR_CYAN,
  549.                       12,
  550.                       &Cursor,
  551.                       INTR_WNDW_PLACE_CENTER);
  552. }
  553.  
  554. static void PullDownMenu3Func(int Index)
  555. {
  556.     char Buffer[80];
  557.     IntrCursorShapeStruct Cursor;
  558.  
  559.     if (IntrPopUpMenu(PUMenu3, INTR_WNDW_PULL_DOWN)) {
  560.         sprintf(Buffer, "Item %d was selected.", PUMenu3 -> SelectedIndex);
  561.     }
  562.     else {
  563.         sprintf(Buffer, "Abort was keyed on item %d.", PUMenu3 -> SelectedIndex);
  564.     }
  565.  
  566.     Cursor.CursorType = INTR_CURSOR_ARROW;
  567.     IntrQueryContinue(Buffer,
  568.                   INTR_COLOR_RED,
  569.                       INTR_COLOR_BLUE,
  570.                       INTR_COLOR_YELLOW,
  571.                       INTR_COLOR_CYAN,
  572.                       12,
  573.                       &Cursor,
  574.                       INTR_WNDW_PLACE_CENTER);
  575. }
  576.  
  577. static void PullDownDataFunc(int Index)
  578. {
  579.     IntrCursorShapeStruct Cursor;
  580.  
  581.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  582.  
  583.     IntrQueryContinue("Pull Down DATA has been selected",
  584.                   INTR_COLOR_RED,
  585.                       INTR_COLOR_BLUE,
  586.                       INTR_COLOR_YELLOW,
  587.                       INTR_COLOR_CYAN,
  588.                       16,
  589.                       &Cursor,
  590.                       INTR_WNDW_PLACE_CENTER);
  591. }
  592.  
  593. static void PullDownViewFunc(int Index)
  594. {
  595.     IntrCursorShapeStruct Cursor;
  596.  
  597.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  598.  
  599.     IntrQueryContinue("Pull Down VIEW has been selected",
  600.                   INTR_COLOR_RED,
  601.                       INTR_COLOR_BLUE,
  602.                       INTR_COLOR_YELLOW,
  603.                       INTR_COLOR_CYAN,
  604.                       16,
  605.                       &Cursor,
  606.                       INTR_WNDW_PLACE_CENTER);
  607. }
  608.  
  609. static void PullDownStatusFunc(int Index)
  610. {
  611.     IntrCursorShapeStruct Cursor;
  612.  
  613.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  614.  
  615.     IntrQueryContinue("Pull Down STATUS has been selected",
  616.                   INTR_COLOR_RED,
  617.                       INTR_COLOR_BLUE,
  618.                       INTR_COLOR_YELLOW,
  619.                       INTR_COLOR_CYAN,
  620.                       16,
  621.                       &Cursor,
  622.                       INTR_WNDW_PLACE_CENTER);
  623. }
  624.  
  625. static void PullDownQuitFunc(int Index)
  626. {
  627.     IntrCursorShapeStruct Cursor;
  628.  
  629.     Cursor.CursorType = INTR_CURSOR_SCROSS;
  630.  
  631.     if (IntrQueryYesNo("Do you want to quit this demo?",
  632.                    INTR_COLOR_RED,
  633.                        INTR_COLOR_BLUE,
  634.                        INTR_COLOR_YELLOW,
  635.                        INTR_COLOR_CYAN,
  636.                        16,
  637.                        &Cursor,
  638.                        INTR_WNDW_PLACE_CENTER)) {
  639.         QuitProgram = TRUE;
  640.     }
  641. }
  642.  
  643. /******************************************************************************
  644. * A function bounded to a quit key.                          *
  645. ******************************************************************************/
  646. static void QuitFunc(int KeyStroke)
  647. {
  648.     IntrClose();
  649.     exit(9);
  650. }
  651.  
  652. /******************************************************************************
  653. * A function bounded to a window handling key.                      *
  654. ******************************************************************************/
  655. static void WndwMenuFunc(int KeyStroke)
  656. {
  657.     int WindowID;
  658.     static IntrBType
  659.     RedWindowISDisplayed = FALSE;
  660.  
  661.     if (IntrPopUpMenu(PUWndwMenu, 0)) {
  662.         switch (PUWndwMenu -> SelectedIndex) {
  663.         case 0: /* Redraw. */
  664.                 IntrWndwRedrawAll();
  665.                 break;
  666.             case 1: /* Move. */
  667.                 if (IntrPopUpActive() == 0 &&
  668.                     (WindowID = IntrWndwPick()) > 0)
  669.             IntrWndwMove(WindowID, TRUE);
  670.                 break;
  671.             case 2: /* Resize. */
  672.                 if (IntrPopUpActive() == 0 &&
  673.                     (WindowID = IntrWndwPick()) > 0)
  674.                     IntrWndwResize(WindowID, TRUE);
  675.                 break;
  676.             case 3: /* Pop. */
  677.                 if (IntrPopUpActive() == 0 &&
  678.                     (WindowID = IntrWndwPick()) > 0)
  679.                     IntrWndwPop(WindowID, TRUE, FALSE);
  680.                 break;
  681.             case 4: /* Push. */
  682.                 if (IntrPopUpActive() == 0 &&
  683.                     (WindowID = IntrWndwPick()) > 0)
  684.                     IntrWndwPush(WindowID, TRUE);
  685.                 break;
  686.             case 5: /* Show Red Window. */
  687.         IntrWndwPop(RWindowID, TRUE, FALSE);
  688.         RedWindowISDisplayed = TRUE;
  689.                 break;
  690.             case 6: /* Hide Red Window. */
  691.             IntrWndwHide(RWindowID, TRUE);
  692.         RedWindowISDisplayed = FALSE;
  693.                 break;
  694.  
  695.         }
  696.     }
  697. }
  698.